﻿<MudDialog Class="test-class" ContentClass="content-class" OnKeyDown="OnKeyDown" OnKeyUp="OnKeyUp">
    <DialogContent>
        <MudText>Wabalabadubdub!</MudText>
    </DialogContent>
    <DialogActions>
        <MudButton OnClick="Cancel">Cancel</MudButton>
        <MudButton Color="Color.Primary" OnClick="Submit">OK</MudButton>
        <MudButton Color="Color.Secondary" OnClick="CloseDefault">OK Default</MudButton>
    </DialogActions>
</MudDialog>

@code {
    [CascadingParameter]
    public IMudDialogInstance MudDialog { get; set; } = null!;

    public KeyboardEventArgs? LastKeyDown { get; private set; }

    public KeyboardEventArgs? LastKeyUp { get; private set; }

    private void Submit() => MudDialog.Close(DialogResult.Ok(true));

    private void CloseDefault() => MudDialog.Close();

    private void Cancel() => MudDialog.Cancel();

    private void OnKeyDown(KeyboardEventArgs arg) => LastKeyDown = arg;

    private void OnKeyUp(KeyboardEventArgs arg) => LastKeyUp = arg;
}
